﻿<%@ Page Title="Производители" Language="C#" MasterPageFile="~/LeftColumn.master" AutoEventWireup="true" CodeBehind="Company.aspx.cs" Inherits="Supermarket.Web.CashierPages.Company" %>
<asp:Content ID="Content1" ContentPlaceHolderID="RightContent" runat="server">
    <asp:ScriptManager ID="ScriptManager1" runat="server">
    </asp:ScriptManager>
    <asp:UpdatePanel ID="upCompanies" runat="server">
        <ContentTemplate>            
            <asp:GridView ID="GridViewCompanies" runat="server" AllowPaging="True" 
                AutoGenerateColumns="False" BackColor="#DEBA84" BorderColor="#DEBA84" 
                BorderStyle="None" BorderWidth="1px" CellPadding="3" CellSpacing="2" 
                DataSourceID="odsCompanies" style="margin-right: 0px" 
                DataKeyNames="CompanyId" PageSize="15">
                <Columns>
                    <asp:CommandField CancelText="Отказ" EditText="Редактирай" 
                        ShowEditButton="True" UpdateText="Обнови" />
                    <asp:BoundField DataField="CompanyName" HeaderText="Производител" 
                        SortExpression="CompanyName" />
                </Columns>
                <FooterStyle BackColor="#F7DFB5" ForeColor="#8C4510" />
                <HeaderStyle BackColor="#A55129" Font-Bold="True" ForeColor="White" />
                <PagerStyle ForeColor="#8C4510" HorizontalAlign="Center" />
                <RowStyle BackColor="#FFF7E7" ForeColor="#8C4510" />
                <SelectedRowStyle BackColor="#738A9C" Font-Bold="True" ForeColor="White" />
                <SortedAscendingCellStyle BackColor="#FFF1D4" />
                <SortedAscendingHeaderStyle BackColor="#B95C30" />
                <SortedDescendingCellStyle BackColor="#F1E5CE" />
                <SortedDescendingHeaderStyle BackColor="#93451F" />
            </asp:GridView>
        </ContentTemplate>
    </asp:UpdatePanel>
    <asp:UpdatePanel ID="upAdd" runat="server">
        <ContentTemplate>
            <asp:FormView ID="fvCompany" runat="server" DefaultMode="Insert" DataSourceID="odsCompanies">
                <InsertItemTemplate>
                    <p>
                        <strong>Компания:</strong>
                        <asp:TextBox ID="txtTitle" runat="server" Text='<%# Bind("CompanyName") %>' /></p>
                    <p>
                        <asp:LinkButton ID="lbAdd" runat="server" Text="Добави" CommandName="Insert" />
                    </p>
                </InsertItemTemplate>
            </asp:FormView>
            <asp:Label ID="LabelError" runat="server" CssClass="failureNotification"></asp:Label>  
        </ContentTemplate>
    </asp:UpdatePanel>   
    <asp:ObjectDataSource ID="odsCompanies" runat="server" 
        InsertMethod="CreateCompany" SelectMethod="GetAllCompanies" 
        TypeName="Supermarket.Bll.CompanyManager" UpdateMethod="Update" 
        oninserted="odsCompanies_Inserted">
        <InsertParameters>
            <asp:Parameter Name="companyName" Type="String" />
        </InsertParameters>
        <UpdateParameters>
            <asp:Parameter Name="companyId" Type="Int32" />
            <asp:Parameter Name="companyName" Type="String" />
        </UpdateParameters>
    </asp:ObjectDataSource>
</asp:Content>
